import { request } from '../../../request';

/**
 * 通过追溯码获取基本信息
 *
 * @param params.pnlId
 * @returns
 */
export function getBasicInformation(params: any) {
  return request({
    url: '/erpsyncmes/mktprodinfo/selectByPnlId',
    method: 'GET',
    params
  });
}

/**
 * 获取物料信息
 *
 * @param params.lotNo 批次号
 * @param path 板材:cutting-sheet-materials-record PP:ppmaterial 干膜:dryfilm 油墨:ink 铜箔：copper
 * @returns
 */

type pathType = 'cutting-sheet-materials-record' | 'ppmaterial' | 'dryfilm' | 'ink' | 'copper';

export function getMaterial(lotNo: String, path: pathType) {
  return request({
    url: `/mes/${path}/entity`,
    method: 'GET',
    params: {
      lotNo
    }
  });
}

/** 获取工艺名称列表 */
export function getTechniqueList(lotId: string) {
  return request({
    url: '/rcerp/production/technology/name',
    method: 'GET',
    params: {
      lotId
    }
  });
}

/** 获取工艺名称详情 */
export function getTechniqueDetail(params: any) {
  return request({
    url: `/rcerp/production/technology/list`,
    method: 'GET',
    params
  });
}

/**
 * 获取品质信息
 *
 * @param params.moduleNo 生产型号
 * @param params.lotNo 批次号
 */
export function getQualityInfo(params: any) {
  return request({
    url: '/qms/review/queryIpqcData',
    method: 'GET',
    params
  });
}

/** 获取所有PNL号 */
export function getAllPnlId(lotId: string) {
  return request({
    url: '/mes/batch-read-code-info/queryAllPnlIdByLotId',
    method: 'GET',
    params: {
      lotId
    }
  });
}

/** 获取PNL清单信息 */
export function getPnlList(params: any) {
  return request({
    url: '/mes/batch-read-code-info/queryPassingRecordByPnlId',
    method: 'GET',
    params
  });
}

/** 获取PCS信息 */
export function getPcsInfo(params: any) {
  return request({
    url: '/mes/batch-read-code-info/queryPcsListByPnlId',
    method: 'GET',
    params
  });
}

/** 获取SET信息 */
export function getSetInfo(params: any) {
  return request({
    url: '/mes/batch-read-code-info/querySetListByPnlId',
    method: 'GET',
    params
  });
}

/** 获取包装信息 */
export function getPackInfo(params: any) {
  return request({
    url: '/rcerp/passStationRecord/selectBoxFollowDetail',
    method: 'GET',
    params
  });
}

/** 获取AOI信息 */
export function getAoiInfo(params: any) {
  return request({
    url: '/qms/oneCodeFileReader/find',
    method: 'GET',
    params
  });
}

/** 获取AVI信息 */
export function getAviInfo(params: any, path: string) {
  return request({
    url: `/qms/${path}/find`,
    method: 'GET',
    params
  });
}

/** 获取工艺列表 */
export function getTechniqueListData() {
  return request({
    url: '/eap/EapEqpTrace2/selectAllTechnology',
    method: 'GET'
  });
}

/** 获取工艺参数信息 */
export function getTechniqueParam(params: any) {
  return request({
    url: '/eap/EapEqpTrace2/selectByPnlIdAndTechId',
    method: 'GET',
    params
  });
}

/** 获取工序报警信息 */
export function getProcessAlarm(params: any) {
  return request({
    url: '/eap/EapEqpTrace2/selectAlamByPnlId',
    method: 'GET',
    params
  });
}

/** 获取入库信息 */
export function getStorageInfo(params: any) {
  return request({
    url: '/rcerp/passStationRecord/selectBoxFollowDetail3',
    method: 'GET',
    params
  });
}
